package cn.cvs.utils;


import cn.cvs.entity.Auction;

import java.util.List;

public class Page {
    private int pageSize = 4;               //页大小
    private int currentPageNo;            //当前页码currentPageNo
    private int totalCount;              //总数据totalCount
    private int totalPageCount;          //总页数totalPageCount
    private int pageIndex;              //页索引
    private List<Auction> pageList;    //当前页面数据

    public Page(int currentPageNo, int totalCount) {
        this.currentPageNo = currentPageNo;
        this.totalCount = totalCount;
        this.totalPageCount = this.totalCount % this.pageSize == 0?(this.totalCount / this.pageSize):(this.totalCount / this.pageSize)+1;
        this.pageIndex = (this.currentPageNo - 1) * this.pageSize;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getCurrentPageNo() {
        return currentPageNo;
    }

    public void setCurrentPageNo(int currentPageNo) {
        this.currentPageNo = currentPageNo;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(int totalPageCount) {
        this.totalPageCount = totalPageCount;
    }

    public int getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public List<Auction> getPageList() {
        return pageList;
    }

    public void setPageList(List<Auction> pageList) {
        this.pageList = pageList;
    }
}
